package yxy.game.pm2.bean.pubsub;

import yxy.apple.util.PubSub.ISubscription;
import yxy.apple.util.PubSub.Publisher;
import yxy.game.pm2.bean.Currency;
import yxy.game.pm2.bean.mq.CCReason;

/**
 * 活动发布
 */
public class ActivityPublisher extends Publisher {
    static private ActivityPublisher instance;

    public static ActivityPublisher getInstance(){
        if (instance == null){
            instance = new ActivityPublisher();
        }
        return instance;
    }

    private ActivityPublisher(){

    }

    public void publish(String playerCode, CCReason reason, Currency currency){
        this.publish(new ActivitySubscription(playerCode,reason,currency));
    }

    /**
     * 发布的消息
     */
    public static class ActivitySubscription implements ISubscription{
        private String playerCode;
        private CCReason reason;	//变动原因
        private Currency currency;

        public ActivitySubscription(String playerCode, CCReason reason, Currency currency){
            this.playerCode = playerCode;
            this.reason = reason;
            this.currency = currency;
        }

        public String getPlayerCode() { return playerCode;}

        public CCReason getReason() { return reason; }

        public Currency getCurrency() { return currency; }
    }
}
